/**
 * @file base64_test.c
 * @brief base64 test
 * @author JakeYang <add358@gmail.com>
 * @version 0.1
 * @date 2016-05-04
 */
#include "base64_test.h"
#include <stdio.h>
#include <string.h>

void base64_test(void)
{
	long len = 0;
	FILE *f = popen("base64 test.png", "r");
	char buffer[1024] = {0};
	if ( f == NULL ) {
		printf("popen failed\n");
		return;
	}
//	fflush(f);
//	if (fseek(f, 1, SEEK_END) == -1) {
//		printf("fseek failed\n");
//		fclose(f);
//		return;
//	}
//	len = ftell(f);
//	rewind(f);
//	printf("len=%ld\n", len);
	while ( !feof(f) ) {
		memset(buffer, 0, 1024);
		fgets(buffer, 1024, f);
//		printf("len(%ld)\n", len);
//		buffer[len] = 0;
		printf("%s", buffer);
	}

//	fgets(buffer, 8192, f);
	pclose(f);

}
